module.exports = {
  devServer: {
    port: 8000,
    client: {
      overlay: {
        warnings: false,
        errors: true
      }
    },
    proxy: {
      '/api': {
        target: 'http://localhost:8001',
        changeOrigin: true,
        ws: true,
        secure: false,
        logLevel: 'info',
        onProxyReq: function (proxyReq, req, res) {
          console.log('代理请求到真实后端:', req.method, req.url, '-> http://localhost:8001' + req.url);
        },
        onProxyRes: function (proxyRes, req, res) {
          console.log('收到后端响应:', proxyRes.statusCode, req.url);
        },
        onError: function (err, req, res) {
          console.error('代理到真实后端失败:', err.message);
          console.error('请确保后端服务已启动并运行在 localhost:8001');
        }
      }
    }
  },
  configureWebpack: {
    resolve: {
      fallback: {
        "path": false,
        "os": false,
        "crypto": false
      }
    }
  }
}